package cn.datashoe.sparkTimeSeries

import com.cloudera.sparkts.models.ESACF
import org.scalatest.FunSuite

class ESACFSuite extends FunSuite {
  val data: Seq[Double] = Seq(
    -0.7645963,
    1.297196,
    0.6684268,
    -1.607385,
    -0.6260048,
    1.484327,
    1.885498,
    -0.009316681,
    -0.3396759,
    -0.9720703,
    -1.86799,
    0.8949122,
    2.638806,
    2.946696,
    2.877056,
    1.162571,
    0.9303286,
    1.72233,
    1.985159,
    2.427854,
    1.465286,
    3.264972,
    3.673337,
    4.362468,
    3.849653,
    2.203451,
    1.766208,
    2.045552,
    0.5108908,
    -0.8377184,
    1.127791,
    0.8509394,
    -0.5876151,
    0.04057314,
    -0.2745,
    1.841507,
    1.152422,
    -0.1830325,
    -0.0942581,
    -1.145601,
    -0.6118088,
    -1.565115,
    -1.195411,
    -1.210969,
    -1.199002,
    0.7432265,
    0.4647355,
    0.4655549,
    -0.8545023,
    -2.205812,
    -0.4594624,
    1.421927,
    1.168172,
    0.1715872,
    -0.1007282,
    0.5527776,
    2.700327,
    2.20518,
    2.847266,
    3.493271,
    2.81455,
    3.31633,
    2.027845,
    -0.06848588,
    -2.234106,
    -0.7367489,
    -2.218402,
    -3.164137,
    -0.6150999,
    1.007252,
    1.394324,
    -0.190602,
    2.186029,
    1.06044,
    -0.6892324,
    -0.04795455,
    0.3010811,
    -0.203175,
    -1.388942,
    -2.46916,
    -2.464309,
    -3.157809,
    -2.329074,
    -0.8525182,
    -1.896752,
    -0.7525859,
    0.6993575,
    0.8271095,
    -1.081455,
    -0.5862738,
    0.008037266,
    -0.743091,
    -0.7964282,
    -0.7613908,
    1.167228,
    0.8658421,
    0.4839877,
    -0.3398455,
    -0.8867167,
    -0.3751704
  )


  test("测试") {
    val mm = ESACF.esacf(data)

    mm.foreach {
      arr => println(arr.mkString(","))
    }


  }

  test("diff") {
    val ts = Array.range(0, 10).map(_.toDouble)
    println(ESACF.diff(ts).mkString(","))
    println(ts.mkString(","))

    println(ESACF.diff(Array(0.0, 1.0, 1.0, 2.0, 3.0, 5.0, 8.0, 13.0, 21.0, 33.0)).mkString(","))

  }

}
